public class Solution2180 {
    public int countEven(int num) {
        int count=0;
        for (int i=1;i<=num;i++){
            if (valid(i)){
                count++;
            }
        }
        return count;
    }

    private boolean valid(int i) {
        int t=0;
        while (i!=0){
            t+=i%10;
            i/=10;
        }
        return t%2==0;
    }

    public static void main(String[] args) {
        System.out.println(new Solution2180().countEven(30));
    }
}
